package com.hello.system.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hello.common.log.annotation.Log;
import com.hello.common.log.enums.BusinessType;
import com.hello.common.security.annotation.RequiresPermissions;
import com.hello.system.domain.FishDetectionModel;
import com.hello.system.service.IFishDetectionModelService;
import com.hello.common.core.web.controller.BaseController;
import com.hello.common.core.web.domain.AjaxResult;
import com.hello.common.core.utils.poi.ExcelUtil;
import com.hello.common.core.web.page.TableDataInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 鱼类检测模型管理Controller
 * 
 * @author hello
 * @date 2025-08-15
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/fishDetectionModel")
public class FishDetectionModelController extends BaseController
{
    private final IFishDetectionModelService fishDetectionModelService;

    /**
     * 查询鱼类检测模型管理列表
     */
    @RequiresPermissions("system:fishDetectionModel:list")
    @GetMapping("/list")
    public TableDataInfo list(FishDetectionModel fishDetectionModel)
    {
        startPage();
        List<FishDetectionModel> list = fishDetectionModelService.selectFishDetectionModelList(fishDetectionModel);
        return getDataTable(list);
    }

    /**
     * 导出鱼类检测模型管理列表
     */
    @RequiresPermissions("system:fishDetectionModel:export")
    @Log(title = "鱼类检测模型管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, FishDetectionModel fishDetectionModel)
    {
        List<FishDetectionModel> list = fishDetectionModelService.selectFishDetectionModelList(fishDetectionModel);
        ExcelUtil<FishDetectionModel> util = new ExcelUtil<FishDetectionModel>(FishDetectionModel.class);
        util.exportExcel(response, list, "鱼类检测模型管理数据");
    }

    /**
     * 获取鱼类检测模型管理详细信息
     */
    @RequiresPermissions("system:fishDetectionModel:query")
    @GetMapping(value = "/{modelId}")
    public AjaxResult getInfo(@PathVariable("modelId") Long modelId)
    {
        return success(fishDetectionModelService.selectFishDetectionModelByModelId(modelId));
    }

    /**
     * 新增鱼类检测模型管理
     */
    @RequiresPermissions("system:fishDetectionModel:add")
    @Log(title = "鱼类检测模型管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FishDetectionModel fishDetectionModel)
    {
        return toAjax(fishDetectionModelService.insertFishDetectionModel(fishDetectionModel));
    }

    /**
     * 修改鱼类检测模型管理
     */
    @RequiresPermissions("system:fishDetectionModel:edit")
    @Log(title = "鱼类检测模型管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FishDetectionModel fishDetectionModel)
    {
        return toAjax(fishDetectionModelService.updateFishDetectionModel(fishDetectionModel));
    }

    /**
     * 删除鱼类检测模型管理
     */
    @RequiresPermissions("system:fishDetectionModel:remove")
    @Log(title = "鱼类检测模型管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{modelIds}")
    public AjaxResult remove(@PathVariable Long[] modelIds)
    {
        return toAjax(fishDetectionModelService.deleteFishDetectionModelByModelIds(modelIds));
    }
}
